<!DOCTYPE html>
<html lang='en'>
<head>
  <meta charset='UTF-8'>
  <title>Title</title>
</head>
<body style="border:5px solid #333;">
  <h1 onclick='handleClick()'>iframePage2</h1>
<script>
  // 回调函数
  function receiveMessageFromIndex ( event ) {
    console.log( 'receiveMessageFromIndex', event )
  }
  // 监听message事件
  window.addEventListener("message", receiveMessageFromIndex, false);

  function handleClick() {
    // //给父页面发送消息，data为对象
    parent.postMessage( {msg: 'MessageFromIframePage'}, '*');
  }

</script>
</body>
</html>
